﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ATM.Common
{
    public class DataConnection
    {
        private static SqlConnection con;
        public static SqlConnection GetConnection()
        {
            con = new SqlConnection(@"Data Source=.;Initial Catalog=ATMSystem;Integrated Security=True");
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
                return con;
            }
            else
                return con;
        }

        public static void CloseConnection()
        {
            con.Close();
        }
    }
}
